from PIL import Image

def img_paste(img1,img2,img3,size,location,out):
    img = Image.open(img1)
    img2 = Image.open(img2)

    img2 = img2.resize(size, Image.ANTIALIAS)
    r, g, b, a = img2.split()

    img.paste(img2, location, mask=a)


    img3 = Image.open(img3)
    img3 = img3.resize((size[0]+1,size[1]+1), Image.ANTIALIAS)
    r, g, b, a = img3.split()
    img.paste(img3, location, mask=a)

    img.save(out)


if __name__ == '__main__':
   img1 = r'./video/img/520520_pay/161.jpg'
   img2 = r'./upload/qq.png'
   img3 = r'./upload/yuan1.png'
   out = r'./result/result.jpg'
   size = (49,49)

   #location = (260, 208)0-100
   location = (422, 256) #101-106

   img_paste(img1,img2,img3,size,location,out)
